//
//  PaperCollectionFootView.m
//  ZYOnlineSchool
//
//  Created by 毕武侠 on 2017/3/14.
//  Copyright © 2017年 bwx. All rights reserved.
//

#import "PaperCollectionFootView.h"
#import "PaperCardView.h"

@interface PaperCollectionFootView ()

@property (nonatomic, strong) PaperCardView *cardView;

@end

@implementation PaperCollectionFootView


- (void)setSourceData:(NSMutableArray *)sourceData {
    _sourceData = sourceData;
    
    [self.cardView setSourceDatas:sourceData];
}

- (void)setShowSendView:(BOOL)showSendView {
    _showSendView = showSendView;
    self.cardView.showSendView = showSendView;
}

- (void)setShowTitleView:(BOOL)showTitleView {
    _showTitleView = showTitleView;
    self.cardView.showTitleView = showTitleView;
}

- (PaperCardView *)cardView {
    if (_cardView == nil) {
        _cardView = [[PaperCardView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64 - 40)];
        _cardView.showTopView = NO;
        [self addSubview:_cardView];
        [[self.cardView getSignalWithDictionary:@{@"action" : @"select"}] subscribeNext:^(id x) {
            if (self.selectBlock) {
                self.selectBlock(x);
            }
        }];
        [[self.cardView getSignalWithDictionary:@{@"action" : @"send"}] subscribeNext:^(id x) {
            if (self.sendBlock) {
                self.sendBlock(x);
            }
        }];
//        self.sendSignal   = [self.view getSignalWithDictionary:@{@"action" : @"send"}];
    }
    return _cardView;
}

@end
